import 'dart:convert';

class VpnListModel {
  int hotId;
  String hotName;
  String hotUrl;
  VpnListModel({
    required this.hotId,
    required this.hotName,
    required this.hotUrl,
  });

  VpnListModel copyWith({
    int? hotId,
    String? hotName,
    String? hotUrl,
  }) {
    return VpnListModel(
      hotId: hotId ?? this.hotId,
      hotName: hotName ?? this.hotName,
      hotUrl: hotUrl ?? this.hotUrl,
    );
  }

  Map<String, dynamic> toMap() {
    return <String, dynamic>{
      'hotId': hotId,
      'hotName': hotName,
      'hotUrl': hotUrl,
      // 'smartId': hotId,
      // 'smartName': hotName,
      // 'smartUrl': hotUrl,
    };
  }

  factory VpnListModel.fromMap(Map<String, dynamic> map) {
    return VpnListModel(
      hotId: map['hotId'] as int,
      hotName: map['hotName'] as String,
      hotUrl: map['hotUrl'] as String,
      // hotId: map['smartId'] as int,
      // hotName: map['smartName'] as String,
      // hotUrl: map['smartUrl'] as String,
    );
  }

  String toJson() => json.encode(toMap());

  factory VpnListModel.fromJson(String source) =>
      VpnListModel.fromMap(json.decode(source) as Map<String, dynamic>);

  @override
  String toString() =>
      'VpnListModel(hotId: $hotId, hotName: $hotName, hotUrl: $hotUrl)';

  @override
  bool operator ==(covariant VpnListModel other) {
    if (identical(this, other)) return true;

    return other.hotId == hotId &&
        other.hotName == hotName &&
        other.hotUrl == hotUrl;
  }

  @override
  int get hashCode => hotId.hashCode ^ hotName.hashCode ^ hotUrl.hashCode;
}
